package avicit.im.lantop.basic.archiveclassmanager.action.rest;


import avicit.im.lantop.basic.archiveclassmanager.action.service.CommonManagerIntfsService;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@Api(tags = "CommonManagerIntfsService", description = "BillDefineManagerIntfsServiceRest")
@RequestMapping("/api/avicit/im/lantop/basic/archiveclassmanager/action/rest/CommonManagerIntfsServiceRest")
public class CommonManagerIntfsServiceRest {


    private static final Logger LOGGER = LoggerFactory.getLogger(CommonManagerIntfsServiceRest.class);


    @Autowired(required = false)
    private CommonManagerIntfsService commonManagerIntfsServiceImpl;


    @PostMapping("/getMenuNameByCodeByIntfs")
    @ApiOperation(value = "根据表ID以及查询条件，获取表的列信息以及数据")
    public ResponseMsg<String> getMenuNameByCodeByIntfs(@ApiParam(value = "根据表ID以及查询条件，获取表的列信息以及数据", name = "map") @RequestBody Map<String,Object> map) {
        ResponseMsg<String> responseMsg = new ResponseMsg<>();
        String menuNameByCodeByIntfs = null;
        try {
            String menuCode = (String) map.get("menuCode");
            String appId = (String) map.get("appId");
            String languageCode = (String) map.get("languageCode");
            menuNameByCodeByIntfs = commonManagerIntfsServiceImpl.getMenuNameByCodeByIntfs(menuCode, appId, languageCode);
            responseMsg.setResponseBody(menuNameByCodeByIntfs);
            responseMsg.setRetCode("200");
        } catch (Exception e) {
            responseMsg.setRetCode("201");
            responseMsg.setErrorDesc(e.getMessage());
            e.printStackTrace();
        }
        return responseMsg;
    }
}
